import request from './request'

/**
 * 上传图片文件
 * @param {File} file 图片文件
 * @returns {Promise}
 */
export function uploadImage(file) {
  const formData = new FormData()
  formData.append('file', file)
  
  return request({
    url: '/file/upload/image',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

/**
 * 上传竞赛封面图片
 * @param {File} file 封面图片文件
 * @returns {Promise}
 */
export function uploadContestCover(file) {
  const formData = new FormData()
  formData.append('file', file)
  
  return request({
    url: '/file/upload/contest-cover',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
} 